package com.example.androidcomplete0102.ch12;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

import com.example.androidcomplete0102.R;

public class ListOnly extends ListActivity {
	ArrayAdapter<CharSequence> arrayAdapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		arrayAdapter = ArrayAdapter.createFromResource(this, R.array.country,
				android.R.layout.simple_list_item_1);
		setListAdapter(arrayAdapter);

	}

	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		String text = "Select Item = " + arrayAdapter.getItem(position);
		Toast.makeText(this, text, Toast.LENGTH_LONG).show();
	}

}
